package com.redis.controller;

import com.redis.RedisMQ.QueueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program:
 * @description:
 * @author: hyq
 * @create: 2022-03-09 10:57
 */
@RestController
public class MqRedisTest {
    @Autowired
    private QueueService queueService;


    @GetMapping("send")
    public void testQueue() throws InterruptedException {
        new Thread(() -> {
            for (int i = 0; i < 1000; i++) {
                queueService.sendMessage("消息" + i);
            }
        }).start();

        new Thread(() -> queueService.onMessage()).start();

        Thread.currentThread().join();
    }

}
